﻿using System;
using System.Web.UI.WebControls;
using MedicWeb.MedicService;

namespace MedicWeb.forms {
    public partial class ComissionList : SessionPage {
        protected void Page_Load(object sender, EventArgs e) {
            var ms = new MainService();
            var comissions = ms.GetComissionList(GetSession(), false);
            foreach (var comission in comissions) {
                var row = new TableRow();
                var cellEdit = new TableCell();
                var cellDelete = new TableCell();
                var cellId = new TableCell();
                var cellTitle = new TableCell();

                cellEdit.Controls.Add(
                    new HyperLink() {
                        NavigateUrl = ResolveUrl("~/forms/Editors/Directory/ComissonEdit.aspx?id=" + comission.Id),
                        CssClass = "modal edit"
                    });
                cellDelete.Controls.Add(
                    new HyperLink() {
                        NavigateUrl = ResolveUrl("~/forms/Delete?id=" + comission.Id+"&class="+comission.Id),
                        CssClass = "delete entity"
                    });
                cellEdit.Width = 24;
                cellDelete.Width = 24;
                cellId.Text = "" + comission.Id;
                cellTitle.Text = comission.Title;

                row.Cells.Add(cellEdit);
                row.Cells.Add(cellDelete);
                row.Cells.Add(cellId);
                row.Cells.Add(cellTitle);

                tblComissions.Rows.Add(row);
            }
        }
    }
}